package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController4 {
    //product/page/100
    @RequestMapping("/product/page/{pageno}")
    public String productPage(@PathVariable("pageno") int pageno) {
        System.out.println(pageno);
        return "index";
    }

    //可选的，在变量后面用冒号分隔，可以写正则表达式对其约束
    @RequestMapping("/product2/page/{pageno:\\d}/{pagesize}")
    public String productPage(@PathVariable("pageno") int pageno,
                              @PathVariable("pagesize") int asdf) {
        System.out.println(pageno + "---" + asdf);
        return "index";
    }
}
